{extend name="pub/base" /}
{block name="title"}
<title>充值码生成</title>
{/block}
{block name="body"}
<div class="Hui-admin-article">
    <div class="Hui-article">
        <article class="clearfix pd-20">
            <form class="form form-horizontal" onsubmit="gen();return false;">
                <div class="row clearfix">
                    <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>加密方式：</label>
                    <div class="formControls col-xs-8 col-sm-9">                      
                        <label>
                            <input name="salt" class="input-radio" type="radio" value="salt"
                                   {$salt=='salt'?'checked':''}/>
                            密码盐
                        </label>
                    </div>
                </div>

                <div class="row clearfix">
                    <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>充值卡面额：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" value="{$chargecode_money}" name="chargecode_money">
                    </div>
                </div>

                <div class="row clearfix">
                    <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>充值码生成个数：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" value="{$chargecode_num}" name="chargecode_num">
                    </div>
                </div>


                <div class="row clearfix">
                    <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                        <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
                        <a href="/admin/chargecodes/index" class="btn btn-success radius">返回</a>
                    </div>
                </div>
            </form>
        </article>
    </div>
</div>
<script>
    function gen() {
        layer.open({
            type: 1,
            title: false,
            area: ['630px', '360px'],
            content: '<p></p><p style="padding-left:15px;font-weight: 400;color:#999;">生成中，请耐心等待</p>'
        });

        $.ajax({
            url: '/admin/chargecodes/gencodes',
            type: 'post',
            data: $("form").serialize(),
            success(data){
                $('.layui-layer-content').append(data);
            }
        })
    }
</script>
{/block}